﻿using System.Web.Mvc;
using System.Web.Mvc.Ajax;

namespace MVCPets.Extensions.MVC
{
  public static class AjaxHelperExtensions
  {

    public static string ImageActionLink(this AjaxHelper helper, string className, string actionName, string controllerName, object routeValues, AjaxOptions ajaxOptions)
    {
      var builder = new TagBuilder("div");

      builder.MergeAttribute("class", className);

      var link = helper.ActionLink("[replaceme]", actionName, controllerName, routeValues, ajaxOptions);

      return link.ToString().Replace("[replaceme]", builder.ToString(TagRenderMode.Normal));
    }

    public static string ImageActionLink(this AjaxHelper helper, string className, string actionName, object routeValues, AjaxOptions ajaxOptions)
    {
      var builder = new TagBuilder("div");

      builder.MergeAttribute("class", className);

      var link = helper.ActionLink("[replaceme]", actionName, routeValues, ajaxOptions);

      return link.ToString().Replace("[replaceme]", builder.ToString(TagRenderMode.Normal));
    }

  }
}
